# To change this template, choose Tools | Templates
# and open the template in the editor.

__author__="furoscame"
__date__ ="29.12.11 23:30"

class FENTranslater(object):
    """
    Translates Leo board positions into FEN and vice versa
    """
    def __init__(self):
        """FEN position"""
        pass

    def get_fen_str(self,leo_pos_str):
        """Take a leo pos and returns a FEN"""
        i = 0
        spc = 0
        fen_string = ""
        while  i<leo_pos_str.len:
            c = leo_pos_str[i]
            if c == '|' or c == '\r':
                pass # ignore this

            elif  c == '\n':
                if spc != 0 :
                    fen_string = fen_string + spc
                fen_string = fen_string + '/'

            elif c == ' ':
                spc = spc + 1

            else:
                if spc != 0 :
                    fen_string = fen_string + spc

                fen_string = fen_string + c

            i = i + 1
        pass


        fen_string = fen_string # + w|b who to move
        
        fen_string = fen_string # rochade KQkq

        fen_string = fen_string # ep field
        
        fen_string = fen_string # half move
        
        fen_string = fen_string # full move

        return fen_string
    pass

    def get_leo_pos_str(self, fen):
        """Take a FEN and returns a leo pos"""
pass